ref(asyncpg): Normalize query whitespace in integration#5855
Merged
ericapisani merged 2 commits intomasterfrom Mar 25, 2026
Merged
ref(asyncpg): Normalize query whitespace in integration#5855ericapisani merged 2 commits intomasterfrom
ericapisani merged 2 commits intomasterfrom
Conversation
…_transaction Collapse newlines and extra whitespace in span descriptions to single spaces before passing events to before_send_transaction. This allows users to write simple string-matching callbacks without needing to account for multi-line SQL or other formatted descriptions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Langchain
Internal Changes 🔧Langchain
Other
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 8.80s All tests are passing successfully. ❌ Patch coverage is 20.00%. Project has 14389 uncovered lines. Files with missing lines (1)
Generated by Codecov Action |
Instead of normalizing span descriptions generically in client.py before calling before_send_transaction, normalize queries at the source in the asyncpg integration. This is more correct because the normalization is specific to SQL query formatting, not a general concern for all span descriptions. Remove _clean_span_descriptions from _Client and the generic tests. Add asyncpg-specific tests for normalized descriptions and before_send_transaction interaction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
Author
|
bugbot review |
sl0thentr0py
approved these changes
Mar 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Normalize multiline SQL query whitespace in the asyncpg integration so that span descriptions contain single-line queries with collapsed whitespace.
asyncpg passes raw multiline SQL strings as span descriptions. This makes it difficult for users to match queries in
before_send_transactioncallbacks — they'd need to account for newlines and varying indentation instead of writing simple substring checks like"SELECT id, name FROM users" in desc.Fixes PY-2255 and #5850